#! /usr/bin/env perl

use strict;
use warnings;

use File::Basename;
use Getopt::Declare;

use VCtools::Base;


# have to do this stuff up here, before VCtools::Common
# has a chance to freak out
# theoretically, the following line is the only place
# this hardcoded path should ever exist
use constant CONFIG_FILE => '/usr/local/etc/VCtools/VCtools.conf';
BEGIN { $ENV{VCTOOLS_CONFIG} = CONFIG_FILE; }

use VCtools::Config;
use VCtools::Common;


our $BINDIR = DEBUG ? dirname($0) : $VCtools::config->{VCtoolsBinDir};
print STDERR "vctools-config: set bin dir to $BINDIR\n" if DEBUG >= 3;


# parends on CONFIG_FILE below are necessary
# elsewise Getopt::Declare seems to think it's a filehandle
my $params = <<END;
	[strict]

	--config		show master configuration file
					{ print CONFIG_FILE(), "\n"; }
	--project		show current project (based on pwd)
					{ print scalar VCtools::parse_vc_file("."), "\n"; }
	--working		show working directory
					{ print "$VCtools::config->{PersonalDir}\n"; }
	--bin			show bin directory
					{ print "$BINDIR\n"; }
END
my $opts = Getopt::Declare->new($params);


# all the work is actually done by Getopt::Declare,
# so there's nothing to do here
